<div class="breadcrumb">
	<a href="<?php echo base_url_admin;?>"><?php echo $lang['HOME'];?></a>
         ::<?php echo $lang['ADVER_MANAG']; ?>
      </div>
<div class="box">
<?php
$message = (isset ( $_GET ['msg'] ) ? $_GET ['msg'] : '');
switch ($message) {
	case 'delete_success' :
		$messages = '<div class="success" id="success">' . $lang ['MSG_DELETE_SUCCESS'] . '</div>';
		break;
	case 'add_success' :
		$messages = '<div class="success" id="success">' . $lang ['ADD_BANNER_SUCCESS'] . '</div>';
		break;
	case 'update_success' :
		$messages = '<div class="success" id="success">' . $lang ['MSG_UPDATE_SUCCESS'] . '</div>';
		break;
}
echo '<div class="message_contain">';
echo @$messages;
echo '</div>';
?>
<div class="heading">
		<h1>
			<img src="../templates/image/report.png" alt="" />

			<?php echo $lang['ADVER_MANAG']; ?>

	</h1>
		<div class="buttons">
			<input class="button" type="button" name="btnadd"
				value="<?php echo $lang['ADD_ADVER']; ?>"
				onClick="javascript:window.location.href='index.php?view=add&amp'; return false;" />&nbsp;&nbsp;&nbsp;
			<!--<input type="button" name="btnedit" value="Edit Banner" onclick="EditSelected(document.frmlist,'<?php //echo htmlspecialchars(getAllGetParams(array('action','view','id')));?>','No item is selected for Editing!','User(s)','Edit')" />-->
			<input class="button" type="button" name="btnpublish"
				value="<?php echo $lang['PUBLISH']; ?>"
				onClick="publishSelected(document.frmlist,'','No items select',1,'Ads','process');" />&nbsp;&nbsp;&nbsp;
			<input class="button" type="button" name="btnunpublish"
				value="<?php echo $lang['UNPUBLISH']; ?>"
				onClick="publishSelected(document.frmlist,'','No items select',0,'Ads','process');" />&nbsp;&nbsp;&nbsp;
			<input class="button" type="button" name="btndelete"
				value="<?php echo $lang['MY_DEL']; ?>"
				onclick="deleteSelected(document.frmlist,'','Ads','process');" /><br />
		</div>
	</div>
	<div class="content">
		<div class="row">
			<form action="#" method="post" name="frmlist">
				<div style="clear: both;">&nbsp;</div>

				<table class="list">
					<thead>
						<tr>
							<td width="4%" align="center"><?php echo $lang['ID']; ?></td>
							<td width="4%" align="center"><input type="checkbox"
								name="chkall" id="chkall"
								onClick="checkAll(this.form,this.checked)"
								style="cursor: pointer;"></td>
							<td width="11%"><?php echo $lang['IMG']; ?></td>
							<td width="14%"><?php echo $lang['ADDVER_TITLE']; ?></td>
							<td width="13%"><?php echo $lang['ADDLINK']; ?></td>
							<td width="12%"><?php echo $lang['START_DATE']; ?></td>
							<td width="14%"><?php echo $lang['END_DATE']; ?></td>
							<td width="10%"><?php echo $lang['POSITION']; ?></td>
							<td width="9%"><?php echo $lang['STATUS']; ?></td>
							<td width="9%"><?php echo $lang['ACTION']; ?></td>
						</tr>
					</thead>
<?php
$imges_edit = "image/edit.gif";
$images_delete = "image/delete.gif";
$qstring = '';
$rowsPerPage = isset ( $_GET ['num'] ) ? $_GET ['num'] : '10';
$sql = "SELECT * FROM tbl_advertisement";
$result = mysql_query ( getPagingQuery ( $sql, $rowsPerPage ) );
$pagingLink = getPagingLink ( $sql, $rowsPerPage, $qstring );
$i = 1;
if(0<mysql_num_rows($result)){
while ( $row = mysql_fetch_assoc ( $result ) ) {
	extract ( $row );
	
	if ($i % 2) {
		$class = 'row1';
	} else {
		$class = 'row2';
	}
	
	?>
<tbody>
						<tr>
							<td width="4%" align="center" class="p_l"><?php echo $row['adv_id']?></td>
							<td width="4%" align="center" class="p_l"><input type="checkbox"
								id="chkall" style="cursor: pointer;" name="id[]"
								value="<?php  echo $row['adv_id'];?>"></td>
							<td width="11%" align="center" class="p_l"><?php echo '<image src="../../images/advertise/'.$row["adv_upload_image"].'" style="width:100px;"/>' ?></td>
							<td width="14%" align="center" class="p_l"><?php echo $row['adv_title']; ?></td>
							<td width="13%" align="center" class="p_l"><a
								href="<?php echo $row['adv_addlink']; ?>"><?php echo $row['adv_addlink']; ?></a></td>
							<td width="12%" align="center" class="p_l"><?php echo  $row['adv_datepost'];?></td>
							<td width="14%" align="center" class="p_l"><?php echo  $row['adv_dateendpost'];?></td>
							<td width="10%" align="center" class="p_l"><?php echo  $row['adv_position'];?></td>
							<td width="9%" align="center" class="p_l"><?php echo stateImage($adv_id,$adv_status);?></td>
							<td width="9%" align="center" class="p_l">
								<div class="btn-group">
									<a class="btn btn-primary btn-inverse"
										href="index.php?view=edit&id=<?php echo $row['adv_id'] ?>"><i
										class="icon-pencil icon-white"><img width="20"	src="../templates/image/Edit.gif"
											alt="<?php echo $lang['EDIT'];?>" /></i></a> <a
										id="btnDeleteMulti" class="btn btn-primary btn-danger"
										onclick="return ConfirmDelete('index.php?view=delete&id=<?php echo $row['adv_id'] ?>')"
										href="javascript:;"><img width="20"
										src="../templates/image/trash.png"
										alt="<?php echo $lang['DELETE'];?>" /></a>
								</div>				
						</tr>
					</tbody>
<?php
	$i ++;
 } // end while
}else{
	echo '<tr><td colspan="10" style="color:red;text-align:center;">No recode found here</td></tr>';
}
?>
</table>
		<div class="row">
                <div class="span7">
                    <div class="wp-pagenavi">
<?php echo $pagingLink; ?>
                        <div class="clear"></div>
                    </div>
                </div>

                </form>
            </div><!--<div class="box">-->
			</form>
		</div>
	</div>
</div>
<!--<div class="row">-->